package org.example.util;

import org.example.entity.FreeTicket;
import org.example.entity.Movie;
import org.example.entity.StudentTicket;
import org.example.entity.Ticket;

/**
 * @author TonySong
 * @date 2025/7/30 0030
 * @time 8:41
 */
public class TicketFactory {

    public static Ticket createTicket(Movie movie,int m) {
        Ticket ticket = null;
        switch (m){
            case 1: ticket=new Ticket(movie);break;
            case 2: ticket=new StudentTicket(movie);break;
            case 3: ticket=new FreeTicket(movie);break;
        }
        return ticket;
    }
    public static Ticket createTicket(Movie movie,String name) {
        Ticket ticket = null;
        switch (name){
            case "普通票": ticket=new Ticket(movie);break;
            case "学生票": ticket=new StudentTicket(movie);break;
            case "赠票": ticket=new FreeTicket(movie);break;
        }
        return ticket;
    }
}
